# -*- coding: utf-8 -*-
import platform, socket, uuid, hashlib, os


# 获取主机名
def get_mac_address():
    mac=uuid.UUID(int = uuid.getnode()).hex[-12:]
    return ":".join([mac[e:e+2] for e in range(0,11,2)])

def generate_sign():
    info_list = []
    info_list.append(str(platform.architecture()))
    info_list.append(platform.processor())
    info_list.append(socket.gethostname())
    info_list.append(get_mac_address())
    info_list.append(os.getlogin())
    content = ";".join(info_list).encode('utf8')
    md5 = hashlib.md5(content).hexdigest()
    return md5

SIGN = ""
def get_sign():
    global SIGN
    if SIGN == "":
        SIGN = generate_sign()
    return SIGN